package com.hirsi.common.core.util;

import java.util.Random;

/**
 * 公共工具类
 */
public class CommonUtil {

    /**
     * 生成随机密码
     * @return
     */
    public static String generatePassword() {
        int passwordLength = 8;
        String chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()";
        StringBuilder password = new StringBuilder();
        Random random = new Random();
        for (int i = 0; i < passwordLength; i++) {
            int index = random.nextInt(chars.length());
            password.append(chars.charAt(index));
        }
        return password.toString();
    }
}
